{$header}
<div id="main" class="main" >
    <div class="content">
  <h3 class="heading">创建采购
<notempty name="_REQUEST.id">
    任务
    <else/>
    订单 
</notempty>
   [ <a href="__URL__">返回列表</a> ]

</h3>
<div id="result" class="result none"></div>
<form class="form-horizontal well" method='post' name="form1" id="form1" action="__URL__/insert/">
<table cellpadding=3 cellspacing=3 >
<php>
$order_detail_id = intval($_REQUEST['id']);
$order_detail = M('Order_detail')->where('id = '.$order_detail_id)->find();
$order_id = $order_detail['order_id'];

</php>
<tr>
    <td width="150px">订单号：</td>
	<td>   {$order_id|getModelName='Order','mano'}
           <input type="hidden" name="order_id" value="{$order_id}">
           <input type="hidden" name="order_detail_id" value="{$order_detail_id}">
            采购时间：<input type="text" class="span2" name="create_time" value="{:toDate(time())}" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})">
        </td>
</tr>

<notempty name="_REQUEST.id"><!--有相应的流转过来的小订单-->
        <tr><td>产品</td><td>
            <input type="hidden" name="inquiry_id" value="{$_REQUEST.inquiry_id}">
            <input type="hidden" name="product_id" value="{$order_detail.product_id}">
        {$order_detail.product_id|getModelName='Product'} {$order_detail.product_id|getPename} {$order_detail.product_id|getCas}
        <input type="hidden" name="jumpUrl" value="__APP__/Toshipping/index"> <!--返回待发货列表-->
         </td> 
        </tr>
<else />
    
    <tr>
    <td class="tRight" >选择已有产品：</td>
    <td class="tLeft" >
        <input type="hidden" name="jumpUrl" value="__URL__">
    
            <div class="input-append">
                <input id="q" name="q" class="input-xlarge search-query" placeholder="搜索"><input id="hz" name="product_id" type="hidden"></input>
                <button class="btn" type="button" onclick="filter()"><i class="icon-search"></i>搜索</button>
            </div>
        </td>
    </tr>
    <tr><td>单价</td><td><input type="text" name='price'>元</td></tr>
 </notempty>
 <tr>
     <td>规格</td>
     <td>
        {$order_detail.specification|modList='Specification',###,'span3','specification'}
    </td>
 </tr>
 <notempty name="_REQUEST.id">
<tr>
     <td>销售订单所需数量</td><td>
     {$order_detail.number} {$order_detail.unit_id|getModelName="Unit"}</td>
 </tr>
 </notempty>
<tr>
     <td>采购任务数量</td><td>
     <input type="text" class="span1" name='number' value="{$order_detail.number}">{:modList( 'Unit',$order_detail['unit_id'] )}
 </td>
 </tr>
 <tr>
     <td>要求交货期</td><td>
     <notempty name="_REQUEST.id">
     <input type="text" name='delivery_date' value="{$order_detail.delivery_date|toDate='Y-m-d'}" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})">
     <else/>
     <input type="text" name='delivery_date' value="{:toDate(time(),'Y-m-d')}" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})">
     
    </notempty>
    </td>
 </tr>
 <empty name="_REQUEST.id" >

<tr>
	<td class="tRight" >经办人：</td>
	<td class="tLeft" >{:modList('User')}
        </td>
</tr>
<tr>
	<td class="tRight">备注：</td>
        <td class="tLeft"><textarea class="span12" name="remark" rows="4"></textarea>
        </td>
</tr>
</empty>
<tr>
	<td></td>
	<td class="center" width="300">
        
        <input type="hidden" name="status" value="0"><!--默认状态为待采购-->
    <button type="submit" class="btn btn-primary"><i class="icon-ok icon-white"></i> 保存</button>
    <a class="btn btn-primary offset1" href="javascript:history.go(-1);"><i class="icon-arrow-left icon-white"></i>返回</a>
	</td>
</tr>
</table>
</form>
<notempty name="_REQUEST.id">
<table class="table table-bordered table-striped table-striped">
    <tr>
        <td>{$order_detail.product_id|getModelName=Product}  </td><td>{$order_detail.product_id|getPename}    <b class="offset1">CAS:{$order_detail.product_id|getCas} </b> 库存</td>
    </tr>
    <tr>
        <th>规格</th><th>库存</th>
    </tr>
    <?php $stocks = M('Stock')->where('product_id ='.$order_detail['product_id'])->findAll(); ?>
    <volist name="stocks" id="st">
        <tr>
            <td>{$st.specification|getModelName='Specification'}</td><td>{$st.number}</td>
        </tr>   
    </volist>
    
</table>
</notempty>
</div>
</div>
<include file="Public:footer" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Js/easyui/themes/default/easyui.css">
<script type="text/javascript" src="__PUBLIC__/Js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Js/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Js/filter-product.js"></script>
<load href="__PUBLIC__/Js/My97DatePicker/WdatePicker.js" />

